package com.geek.water.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/7/25
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("bill")
@ApiModel(description = "账单表")
public class Bill implements Serializable {
    @ApiModelProperty("主键，自增账单ID")
    @TableId(type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("账单编号，业务主键")
    @TableField("bill_code")
    private String billCode;


    @ApiModelProperty("关联客户ID")
    @TableField("customer_id")
    private Long customerId;

    @ApiModelProperty("计费周期(格式: yyyy-MM)")
    @TableField("billing_period")
    private String billingPeriod;

    @ApiModelProperty("账单金额")
    @TableField("amount")
    private BigDecimal amount;

    @ApiModelProperty("账单状态")
    @TableField("status")
    private String status;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    private LocalDateTime createdAt;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("更新时间")
    private LocalDateTime updatedAt;

    @ApiModelProperty("支付时间")
    @TableField("paid_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime paidTime;

    @TableField(exist = false)
    private Device device;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("开票状态：0-未开票，1-已开票")
    @TableField("invoiced")
    private Integer invoiced;
}
